#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTextCodec>
#include <QDebug>
#include <QTime>
#include <time.h>
//#include <stdlib.h>
#include "user_protocol.h"
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
    void find_seralport();  /* 查找可用的串口 */
    void user_display(char *s, int size);
private slots:
    void on_openPortBtn_clicked();
    void read_Com();			//手动添加的槽函数声明，用于读出串口缓冲区的内容


    void on_pushButton_4_clicked();


    void on_pushButton_clicked();

    void on_pushButton_8_clicked();

    void on_pushButton_6_clicked();

    void on_pushButton_3_clicked();

    void on_pushButton_5_clicked();

    void on_pushButton_7_clicked();

    void on_pushButton_9_clicked();

    void on_pushButton_2_clicked();

    void on_pushButton_10_clicked();

    void on_pushButton_11_clicked();

    void on_pushButton_22_clicked();

    void on_pushButton_12_clicked();

private:
    Ui::MainWindow *ui;

    QSerialPort serial;			//声明串口类

    QString s = "MCU ID";
    QString s2 = "LoRa parm ";

    QString s3 = "lamp_num_max";
    QString s4 = "current_ratio";
    QString s5 = "lamp_power";
    QString s6 = "interval_time";

    QString s7 = "sys_id[";

    QString s8 = "gw_addr[";
    QString s9 = "gw_chan[";

    char mcu[12] = {0};
    char lora[5] = {0};
    char gate[3] = {0};
    int run[6] = {0};
    int sys_id = 0;
};

#endif // MAINWINDOW_H
